package com.wangjiangwen.config;

import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.wangjiangwen.bean.SnowFlake;
import com.wangjiangwen.util.IdUtil;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CustomIdGenerator implements IdentifierGenerator {

    SnowFlake snowFlake = IdUtil.createSnowFlake(1);

    @Override
    public Number nextId(Object entity) {
        return snowFlake.nextId();
    }
}